<?

class Facture extends Model {

    public $_id;
    public $facture_id;
    public $contact_id;
    public $user_id;
    public $date;
    public $echeance;
    public $type_reglement;
    public $montant_ht;
    public $montant_ttc;
    public $montant_remise;
    public $taux_remise;
    public $montant_55;
    public $montant_196;
    public $ref_commande;
    public $accompte;
    public $devis_id;
    
    public function getNextID(&$mysql){
    	$query = "SELECT count(*) as nb FROM facture WHERE user_id = '".$_SESSION["user_id"]."';";
    	$res = $mysql->query($query);
    	if($mysql->errno != 0) throw new Exception ("Erreur MySQL : ".$mysql->error);
    	$line = $res->fetch_object();
    	return ($line->nb+1);
    }
}